from django.db import models

from home.utils.BaseModel import BaseModel


# Create your models here.
class NavModel(BaseModel):
    navname = models.CharField(max_length=50)

    position = models.BooleanField(default=False)
    link = models.CharField(max_length=100, null=True, blank=True)

    def __str__(self):
        return self.navname

    class Meta:
        db_table = 'Nev'


class BannerModel(BaseModel):
    name = models.CharField(max_length=50)
    imgurl = models.CharField(max_length=100)
    link = models.CharField(max_length=200, null=True, blank=True)

    def __str__(self):
        return self.name

    class Meta:
        db_table = 'Banner'


class CateModel(BaseModel):
    catename = models.CharField(max_length=50)
    parent = models.ForeignKey('self', null=True, blank=True, related_name='children', on_delete=models.SET_NULL)
    is_honme = models.BooleanField(default=True)
    is_hot = models.BooleanField(default=False)
    is_good = models.BooleanField(default=False)

    def __str__(self):
        return self.catename
    class Meta:
        db_table = 'Cate'